<?php
    session_start();

    $email=$_POST['email'];
    $username=$_POST['username'];
    $password=$_POST['password'];

    include("connect.php");

    if($email&&$username&&$password){
        if(ereg("kura.com$",$_POST['email'])){
            mkdir($username,0777);
            mysql_query("insert into pengguna (username, email, password) values ('$username','$email','$password');");
            $query=mysql_query("select * from pengguna where email='$email'");
            $ambil=mysql_fetch_assoc($query);
            $ID = $ambil['ID'];
            mysql_query("insert into file (filename, owner, version, serverlocation) values('$username',$ID,0,'$username')");
            echo("Your Registration was Success, Welcome to KuraKura");
            include("index.php");
        }
        else{
            echo("Sorry Your Email was incorrect, that must be ended by kura.com");
            include("Registrasi.php");
        }
    }
    else{
        echo("Sorry, Form was not Complete, Please Try Again");
        include("Registrasi.php");
    }
?>

